#ifndef ELITE_ROBOT_SDK_PROTOCOL_H
#define ELITE_ROBOT_SDK_PROTOCOL_H
#include "elite_robot_sdk_param.h"

#define ROBOT_ID_NUM (1)

#define ELITE_SDK_PARSE_JSON_OK                                             (0)
#define ELITE_SDK_PARSE_JSON_STR_ERR                                        (1)
#define ELITE_SDK_JSON_NO_RESLUT_STR_ERR                                    (2)
#define ELITE_SDK_JSON_RESLUT_STR_UNKNOWN_ERR                               (3)
#define ELITE_SDK_SYNC_SEND_DATA_ERR                                        (4)
#define ELITE_SDK_SYNC_PARAMS_ERR                                           (5)
#define ELITE_SDK_SET_SYS_VALUE_ERR                                         (6) //设置系统参数值失败
#define ELITE_SDK_OPT_TIMEOUT_ERR                                           (7) //执行动作超时
#define ELITE_SDK_JSON_ERROR_INFO_ERR                                       (8) //回复字符串中包含error信息

#define ELITE_SDK_PARSE_FALSE                                               (0)
#define ELITE_SDK_PARSE_TRUE                                                (1)

#define ELITE_SDK_NOWAY_POINT_MOTION                                        (-1)

class EliteRobotSdkProtocol
{
public:
    EliteRobotSdkProtocol();
    void sdk_assemble_base_info(rapidjson::Writer<rapidjson::StringBuffer>& writer,std::string method_name,int robot_id);
    std::string sdk_assemble_method_no_param(std::string method_name);
    std::string sdk_assemble_method_with_param(std::string method_name, EliteRobotSdkParamBase& param);

    int sdk_prase_bool_reply(std::string jsonStr, int& nReslut);
    int sdk_prase_int_reply(std::string jsonStr, int& nReslut);
    int sdk_prase_double_reply(std::string jsonStr, double& dReslut);
    int sdk_prase_6d_reply(std::string jsonStr, Param6D& param);

    /*********************************************2.2.1 伺服服务 (ServoService)*/
    //2.2.1.1 获取机械臂伺服状态
    std::string sdk_assemble_getServoStatus_str();
    //2.2.1.2 设置机械臂伺服状态
    std::string sdk_assemble_set_servo_status_str(EliteSetServoStatus servo_status);
    //2.2.1.3 同步伺服编码器数据
    std::string sdk_assemble_syncMotorStatus_str();
    //2.2.1.4 清除报警
    std::string sdk_assemble_clearAlarm_str();
    //2.2.1.5 获取同步状态
    std::string sdk_assemble_getMotorStatus_str();

    /*******************************************2.2.2 参数服务 (ParamService)*/
    //2.2.2.30 设置碰撞使能
    std::string sdk_assemble_setCollisionEnable_str(EliteColEnable enable);

    /*******************************************2.2.3 运动服务 (MovementService)*/
    //2.2.3.9 停止机器人运行
    std::string sdk_assemble_stop_str();
    //2.2.3.13 运行 jbi 文件
    std::string sdk_assemble_runJbi_str(EliteJbiFilename jbi_filename);
    //2.2.3.15 设置机器人运行速度
    std::string sdk_assemble_setSpeed_str(EliteSpeedValue speed_value);

    /*********************************************2.2.6 变量服务 (VarService)*/
    //2.2.6.3 获取系统 I 变量值
    std::string sdk_assemble_getSysVarI_str(EliteGetSystemVar get_system_vari);
    //2.2.6.4 设置系统 I 变量值
    std::string sdk_assemble_setSysVarI_str(EliteSetSystemVar<int> set_system_vari);
    //2.2.6.5 获取系统 D 变量值
    std::string sdk_assemble_getSysVarD_str(EliteGetSystemVar get_system_vard);
    //2.2.6.5 获取系统 D 变量值
    std::string sdk_assemble_setSysVarD_str(EliteSetSystemVar<double> get_system_vard);

};


#endif // ELITE_ROBOT_SDK_PROTOCOL_H
